//#include <stdio.h>
//#include <stdlib.h>
//#include <time.h>
//struct card{
//	int  point;
//	int face;
//};
//char *Face[4]={"红心","方块","梅花","黑桃"};
//char *Point[13]={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
//struct card Player[4][13];
//void Dispcard()
//{
//	char i,j;
//	printf("Player1\tPlayer2\tPlayer3\tPlayer4\n");
//	for(j=0;j<13;j++)
//	{
//		for(i=0;i<4;i++)
//		{
//			printf("%3s%2s\t",Face[Player[i][j].face],Point[Player[i][j].point]);
//		}
//		printf("\n");
//	}
//}
//void RandCard(int *num)
//{
//	int i,j,tmp;
//	srand((unsigned)time(NULL));
//	for(i=0;i<52;i++)
//	{
//		while(1)
//		{
//			tmp=rand()%52;
//			for(j=0;j<i;j++)
//				if(tmp==num[j])
//					break;
//			if(j==i)
//			{
//				num[i]=tmp;
//				break;
//			}
//		}
//	}
//}
//int main()
//{
//	char card,i,j;
//	int num[52];
//	RandCard(num);
//	for(card=1;card<=52;card++)
//	{
//		i=(card-1)%4;
//		j=(card-1)/4;
//		Player[i][j].face=(num[card-1])%4;
//		Player[i][j].point=(num[card-1])/4;
//	}
//	Dispcard();
//	return 0;
//}

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct card {
	int point;
	int face;
};

char *Face[4] = {"红心", "方块", "梅花", "黑桃"};
char *Point[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
struct card Player[4][13];

void Dispcard() {
	int i, j;
	printf("Player1\tPlayer2\tPlayer3\tPlayer4\n");
	for (j = 0; j < 13; j++) {
		for (i = 0; i < 4; i++) {
			printf("%3s%2s\t", Face[Player[i][j].face], Point[Player[i][j].point]);
		}
		printf("\n");
	}
}

void RandCard(int *num) {
	int i, j, tmp;
	srand((unsigned)time(NULL));
	for (i = 0; i < 52; i++) {
		while (1) {
			tmp = rand() % 52;
			for (j = 0; j < i; j++) {
				if (tmp == num[j]) {
					break;
				}
			}
			if (j == i) {
				num[i] = tmp;
				break;
			}
		}
	}
}

int main() {
	int card, i, j, num[52]={0};
	RandCard(num);
	for (card = 0; card < 52; card++) {
		i = (card % 4);
		j = (card / 4);
		Player[i][j].face = num[card] % 4;
		Player[i][j].point = num[card] / 4;
	}
	Dispcard();
	return 0;
}
